package controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.Charset;

@WebServlet("/aa")
public class Defalut extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        File f=new File("D:\\project\\ch05\\src\\main\\webapp\\statics\\html\\search.html");
        PrintWriter out=resp.getWriter();
        InputStream in=new FileInputStream(f);
        byte[] b=new byte[1024];
        while (in.read(b)!=-1){
            out.write(new String(b,"UTF-8"));
            System.out.println(new String(b,"UTF-8"));
        }

    }
}
